﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.ComponentModel;
using System.Text;
using Global.Class.Library;

namespace DataTransferObject.MetaDataList
{
    public class ListCustomerNameSalesmen : NotifyPropertyChangeObject
    {
        private int salesmenID;
        
        private string description;
        private string other;

        private bool inActive;


        public ListCustomerNameSalesmen()
            : this(-1, "", "", false )
        {
        }

        public ListCustomerNameSalesmen(int salesmenID, string description, string other, bool inActive)
        {
            GlobalDefaultValue.Apply(this);

            this.SalesmenID = salesmenID;            
            this.Description = description;
            this.Other = other;
            this.InActive = inActive;
            
        }


        #region Properties

        [DefaultValue(-1)]
        public int SalesmenID
        {
            get { return this.salesmenID; }
            set { ApplyPropertyChange<ListCustomerNameSalesmen, int>(ref this.salesmenID, o => o.SalesmenID, value); }
        }

    
        [DefaultValue("")]
        public string Description
        {
            get { return this.description; }
            set { ApplyPropertyChange<ListCustomerNameSalesmen, string>(ref this.description, o => o.Description, value); }
        }

        [DefaultValue("")]
        public string Other
        {
            get { return this.other; }
            set { ApplyPropertyChange<ListCustomerNameSalesmen, string>(ref this.other, o => o.Other, value); }
        }

        [DefaultValue(false)]
        public bool InActive
        {
            get { return this.inActive; }
            set { ApplyPropertyChange<ListCustomerNameSalesmen, bool>(ref this.inActive, o => o.InActive, value); }
        }

        #endregion

        protected override System.Collections.Generic.List<ValidationRule> CreateRules()
        {
            List<ValidationRule> validationRules = base.CreateRules();
            validationRules.Add(new SimpleValidationRule("SalesmenID", "Please fill a salesmen name.", delegate { return (this.SalesmenID > 0); }));

            return validationRules;
        }
    }
}
